//
//  LXNavigationController.m
//  LvXi_newVersion
//
//  Created by 诸葛孔明 on 16/8/10.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "LXNavigationController.h"

#import "LxNavigationButton.h"

#import "LXMallFrame.h"

@interface LXNavigationController ()<UIGestureRecognizerDelegate,UINavigationControllerDelegate>

@end

@implementation LXNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.interactivePopGestureRecognizer.delegate = self;
    self.delegate = self;
}

/**
 *  添加手势 实现右滑返回
 *
 *  @param gestureRecognizer 手势
 *
 *  @return BOOL
 */
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
    return (self.childViewControllers.count > 1)&&self.enableswipright;
}

-(void)setEnableswipright:(BOOL)enableswipright{
    _enableswipright = enableswipright;
    self.interactivePopGestureRecognizer.delegate = enableswipright?self:nil;
    self.delegate =enableswipright?self:nil;
}


/**
 *  横屏相关
 */
-(BOOL)shouldAutorotate{
    return [self.topViewController shouldAutorotate];
}

-(UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return [self.topViewController shouldAutorotate];
}


-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return [self.topViewController preferredInterfaceOrientationForPresentation];
}

@end
